import Vue from 'vue';
import App from './App.vue';
import ElementUI from 'element-ui';
import VueRouter from 'vue-router';
import routes from './router';
import VueCookies from 'vue-cookies';
import 'element-ui/lib/theme-chalk/index.css';
import 'element-ui/lib/theme-chalk/display.css';
import '../theme/index.css';
import axios from 'axios';

Vue.config.devtools = true;

Vue.prototype.$ajax = axios;

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter);
Vue.use(VueCookies);

const router = new VueRouter({
  mode: 'history',
  routes
});
Vue.config.productionTip = false;
Vue.use(ElementUI);

new Vue({
  render: h => h(App),
  router
}).$mount('#app')
